//
//  DHWeatherView.m
//  DHKuaiYi
//
//  Created by 韩旭 on 16/11/13.
//  Copyright © 2016年 30-陈辉华. All rights reserved.
//

#import "DHWeatherView.h"
#import "Masonry.h"
@implementation DHWeatherView

- (void)xhhSetupSubviews
{
    [super xhhSetupSubviews];
    
    self.backgroundColor = [UIColor XHH_colorWithHex:0xE6F6F9];
    [self setupUI];
}

/*
 #E6F6F9
@property (strong, nonatomic) UIImageView *weatherImg;

@property (strong, nonatomic) UILabel *weatherLabel;

@property (strong, nonatomic) UILabel *cityLabel;

@property (strong, nonatomic) UIImageView *centerImg;

@property (strong, nonatomic) UILabel *temperatureLabel;
@property (strong, nonatomic) UILabel *timeLabel;
*/
-(void)setupUI{
    //实例化 w_qingzhuanduoyun
    UIImageView *weatherImg = [[UIImageView alloc]init];
    weatherImg.image = [UIImage imageNamed:@"sun.jpg"];
    CGSize weatherImgSize =CGSizeMake(40, 40);
    
    UILabel *weatherLabel = [[UILabel alloc]init];
    weatherLabel.text = @"晴";
    weatherLabel.textColor =[UIColor XHH_colorWithHex:0x2FC5C5];
    
    UILabel *cityLabel = [[UILabel alloc]init];
    cityLabel.text = @"深圳市";
    cityLabel.textColor =[UIColor XHH_colorWithHex:0x2FC5C5];
    
    UIImageView *centerImg = [[UIImageView alloc]init];
    centerImg.image = [UIImage imageNamed:@"ic_fack_keyboard_btn_send.jog"];
    CGSize centerImgSize = CGSizeMake(1, 60);
    
    UILabel *temperatureLabel = [[UILabel alloc]init];
    temperatureLabel.text = @"温度: 0~~22C";
    temperatureLabel.textColor =[UIColor XHH_colorWithHex:0x2FC5C5];

    UILabel *timeLabel = [[UILabel alloc]init];
    timeLabel.text = @"2016年11月11日";
    timeLabel.textColor =[UIColor XHH_colorWithHex:0x2FC5C5];

    
    [self addSubview:weatherImg];
    [self addSubview:weatherLabel];
    [self addSubview:cityLabel];
    [self addSubview:centerImg];
    [self addSubview:temperatureLabel];
    [self addSubview:timeLabel];

    //记录
    self.weatherImg = weatherImg;
    self.weatherLabel = weatherLabel;
    self.cityLabel = cityLabel;
    self.centerImg = centerImg;
    self.temperatureLabel = temperatureLabel;
    self.timeLabel = timeLabel;
    
    //自动布局
    [weatherImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(15);
        make.left.mas_equalTo(self).offset(15);
        make.size.mas_equalTo(weatherImgSize);
    }];
    [weatherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self);
        make.left.mas_equalTo(weatherImg.mas_right).offset(5);
        
        
    }];
    [cityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.mas_equalTo(self);
        make.left.mas_equalTo(weatherLabel.mas_right).offset(10);
        
    }];
    [centerImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(8);
        make.centerX.mas_equalTo(self);
        make.size.mas_equalTo(centerImgSize);

    }];
    [temperatureLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(15);
        make.left.mas_equalTo(centerImg.mas_right).offset(25);

        
    }];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(temperatureLabel.mas_bottom).offset(8);
        make.left.mas_equalTo(centerImg.mas_right).offset(25);

    }];
}
@end










